import 'package:flutter/material.dart';

import '../util.dart';

class TPTabBar extends StatelessWidget {
  const TPTabBar({
    required this.tabCtrl,
    required this.tabTitles,
  });
  final TabController tabCtrl;
  final List<String> tabTitles;
  @override
  Widget build(BuildContext context) {
    return TabBar(
      controller: tabCtrl,
      isScrollable: true,
      unselectedLabelStyle: TextStyle(fontSize: 14.sp),
      labelStyle: TextStyle(fontSize: 15.sp, fontWeight: FontWeight.bold),
      labelColor: ColorsUtil.blue,
      indicatorWeight: 2.r,
      indicatorPadding: EdgeInsets.symmetric(horizontal: 0.r),
      unselectedLabelColor: ColorsUtil.title,
      indicatorSize: TabBarIndicatorSize.label,
      tabs: tabTitles
          .asMap()
          .map(
            (key, value) => MapEntry(
              key,
              Tab(
                text: value,
              ),
            ),
          )
          .values
          .toList(),
    );
  }
}
